package com.example.demo.customer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.List;

@RequestMapping(path = "api/v2/customer")
@RestController
@Deprecated
public class CcstomerController {

    private final CustomerService customerService;

    @Autowired
    public CcstomerController(CustomerService customerService) {
        this.customerService = customerService;
    }

    @GetMapping(value = "all")
    List<Customer> getCustomer() {
        return Collections.singletonList(
        new Customer(0L, "V2", "123", "email@gmail.com")
        );
    }

   @PostMapping
   void createNewCustomer(@RequestBody Customer customer){
       System.out.println("POST 请求...");
       System.out.println(customer);
   }
    @PutMapping
    void updateCustomer(@RequestBody Customer customer) {
        System.out.println("UPDATE 请求...");
        System.out.println(customer);
    }
    @DeleteMapping(path="{customerId}")
    void deleteCustomer(@PathVariable("customerId") Long id){
        System.out.println("DELETE 请求.删除 Customer.其ID为"+id);
    }

}
